<?php
namespace app\admin\validate;
use think\Validate;
class Banner extends Validate
{
    //验证规则
    protected $rule = [
        'title'   =>  'require|max:25|unique:article',
        'sort'    =>  'require',
    ];
    //错误提示
    protected $message = [
        'title.require'  => '轮播图标题必须填写',
        'title.max'      => '轮播图标题长度不能大于25位',
        'title.unique'   => '轮播图标题不得重复',
        'sort.require'   => '轮播图排序必须填写',
    ];
    //验证场景
    protected  $scene = [
        'add'  => ['title'=>'require','sort'],
        'edit' => ['title'=>'require'],
    ];
}
